<template>
    <div style="height:75vh;">
        <vxe-table
            show-overflow
            auto-resize
            :border="true"
            height="auto"
            size="small"
            :scroll-y="{enabled: true}"
            :data="dataList">
                <vxe-column type="seq" align="center" title="序号" width="60"> </vxe-column>
                <vxe-column field="createTime" align="center" title="日期"> </vxe-column>
                <vxe-column field="taskName" align="center" title="农事任务"> </vxe-column>
                <vxe-column field="shengyuqiName" align="center" title="生育时期"> </vxe-column>
                <vxe-column field="growthName" align="center" title="长势状况">
                    <template #default="{row}">
                        <span :style="{color:row.growthColor}">{{ row.growthName }}</span>
                    </template> 
                </vxe-column>
                <vxe-column field="createName" align="center" title="记录人"> </vxe-column>
                <vxe-column field="title" align="center" title="现场记录"> 
                    <template #default="{row}">
                        <el-button  type="text" plain @click="lineConfirm(row)">查看记录</el-button>
                    </template>  
                </vxe-column>
        </vxe-table>
    </div>
</template>

<script setup>
import {ref,onMounted} from "vue"
import {getFarmGrowthList} from '@/api/plant'
import {useUserStore} from '@/pinia/modules/user'
import { useRouter } from 'vue-router'
const router = useRouter()
const userStore = useUserStore()
const props = defineProps({
    detail:{
        type:Object,
        default:{}
    }
})
const emit = defineEmits(['set'])
   
const dataList= ref([])


onMounted(async ()=>{
  let res = await  getFarmGrowthList({
    companyId:userStore.userInfo.companyId,
    farmId:userStore.userInfo.farmId,
    farmLandId:props.detail.farmLandId,//149586,
    queryEntry:1,
    farmingType:1,
    page:1,
    limit:1000})
    if(res.success){
        dataList.value = res.data ||[]
    }
})
const lineConfirm =(item)=>{
    router.push(`/manage/crop/index?plantingPlanTaskRecordId=${item.plantingPlanTaskRecordId}&plantingPlanId=${item.plantingPlanId}&companyId=${item.companyId}&farmId=${item.farmId}`)
}

</script>

<style lang="scss" scoped>

</style>